<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Category;
class CategorySeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $categories = [
            [
                'title' => '头像',
                'slug' => 'touxiang',
                'description' => '好看的头像'
            ],
            [
                'title' => '美图',
                'slug' => 'meitu',
                'description' => '好看的图片'
            ],
            [
                'title' => '壁纸',
                'slug' => 'bizhi',
                'description' => '好看的壁纸'
            ]
        ];
        foreach($categories as $category) {
            if (!Category::where('slug', $category['slug'])->first()) {
                Category::create($category);
            }
        }
    }
}
